package cn.ruituo.adv5;
import java.io.*;
public class BufReaderTest {
    public static void main(String[] args) {
        //包装流
        //探测文件的编码格式
        BufferedReader br=null;
        try {
             br=new BufferedReader(new FileReader("E:\\temp\\java72\\advance\\java72.txt"));
            String str=null;
            //自动去掉换行符
            int k=0;
            while((str=br.readLine())!=null){
                System.out.print(++k+":"+str.length()+":");
                byte[]b=str.getBytes("utf-8");
                String s2=new String(b,"gbk");
                System.out.println(s2);
            }

        } catch (Exception e) {
            e.printStackTrace();
        }finally {
            if(br!=null) {
                try {
                    br.close();//?
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
